package com.eas.web.common.chart.line;

import java.util.LinkedList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

public class MultiLineChart {

    private String titleText;

    private List<LineValueArray> valueArrays;

    private int yAxisMin;

    private int yAxisMax;

    private int yAxisSteps;

    private List<String> xAxisLabels;

    public MultiLineChart() {
        this.valueArrays = new LinkedList<LineValueArray>();
        this.xAxisLabels = new LinkedList<String>();
    }

    public void addValueArray(LineValueArray valueArray) {
        valueArrays.add(valueArray);
    }

    public void addXaxisLabel(String label) {
        xAxisLabels.add("\"" + StringUtils.trimToEmpty(label) + "\"");
    }

    public String renderTitleText() {
        return titleText;
    }

    public String renderXaxisLabels() {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        sb.append(StringUtils.join(xAxisLabels, ","));
        sb.append("]");
        return sb.toString();
    }

    public String getTitleText() {
        return titleText;
    }

    public void setTitleText(String titleText) {
        this.titleText = titleText;
    }

    public int getyAxisMin() {
        return yAxisMin;
    }

    public void setyAxisMin(int yAxisMin) {
        this.yAxisMin = yAxisMin;
    }

    public int getyAxisMax() {
        return yAxisMax;
    }

    public void setyAxisMax(int yAxisMax) {
        this.yAxisMax = yAxisMax;
    }

    public int getyAxisSteps() {
        return yAxisSteps;
    }

    public void setyAxisSteps(int yAxisSteps) {
        this.yAxisSteps = yAxisSteps;
    }

    public List<String> getxAxisLabels() {
        return xAxisLabels;
    }

    public void setxAxisLabels(List<String> xAxisLabels) {
        this.xAxisLabels = xAxisLabels;
    }

    public List<LineValueArray> getValueArrays() {
        return valueArrays;
    }
}
